{函数f(n) 计算n的所以小于它本身的因子的和 }
function f(n:longint):longint;
var
	i:longint;
	sum:longint=0;
begin
	for i:=1 to n div 2 do
	if n mod i=0 then
		sum:=sum+i;
	f:=sum;
end;


var
	x:integer=5;
	n:longint;
begin
	while(x>0)do
	begin
		read(n);
		if n=f(n) then
			write('1 ')
		else
			write('0 ');
		dec(x);
	end;
end.